package top.greatxiaozou.mapper;

import org.apache.ibatis.session.SqlSession;
import top.greatxiaozou.pojo.User;

import java.util.List;

public class UserMapperImpl implements UserMapper {
    private SqlSession sqlSession;

    public SqlSession getSqlSession() {
        return sqlSession;
    }

    public void setSqlSession(SqlSession sqlSession) {
        this.sqlSession = sqlSession;
    }

    @Override
    public List<User> selectUser() {
        this.addUser(new User(7, "k456", "15155"));
        return sqlSession.getMapper(UserMapper.class).selectUser();
    }

    @Override
    public int deleteUser(int id) {
        return sqlSession.getMapper(UserMapper.class).deleteUser(id);
    }

    @Override
    public int addUser(User user) {
        return sqlSession.getMapper(UserMapper.class).addUser(user);
    }
}
